<template>
     <el-menu
    default-active="2"
    class="el-menu-vertical-demo"
    :collapse="isCollapse"
    @open="handleOpen"
    @close="handleClose"
    router
  >
  <el-menu-item :index="item.auth_path"  v-for="item in acl" v-show="item.children.length == 0" >
      <el-icon><icon-menu /></el-icon>
      <template #title>{{ item.auth_name }}</template>
    </el-menu-item>
    <el-sub-menu :index="item.auth_path" v-for="item in acl" v-show="item.children.length !== 0" >
      <template #title>
        <el-icon><location /></el-icon>
        <span>{{ item.auth_name }}</span>
      </template>
      <el-menu-item-group v-for="itemSon in item.children" v-show="itemSon.is_nav === 1">
        <el-menu-item :index="itemSon.auth_path">{{ itemSon.auth_name }}</el-menu-item>
      </el-menu-item-group>
    </el-sub-menu>
  </el-menu>
</template>
<script setup>
import { ref } from 'vue'
import {
  Document,
  Menu as IconMenu,
  Location,
  Setting,
} from '@element-plus/icons-vue'
// 引入登录接口
// import { loginApi } from '../api/login';
const isCollapse = ref(false)
const handleOpen = (key, keyPath) => {
//   console.log(key, keyPath)
}
const handleClose = (key, keyPath) => {
//   console.log(key, keyPath)
}
const acl = JSON.parse(localStorage.getItem('acl'))
// console.log('acl',acl);
// 调用接口
// loginApi().then(res=>{
    
// })

</script>
<style lang="scss" scoped>
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 200px;
  height: 100vh;
  min-height: 400px;
  background-color: #ccc;
}
</style>